<include file="Common/header" />
<title>招聘信息</title>
<link rel="stylesheet" href="__PUBLIC__/xheditor-1.2.2/demos/common.css" type="text/css" media="screen" />
<script type="text/javascript" src="__PUBLIC__/xheditor-1.2.2/xheditor-1.2.2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/xheditor-1.2.2/xheditor_lang/zh-cn.js"></script>
<script type="text/javascript" src="__PUBLIC__/h-ui/lib/jquery/1.9.1/jquery.form.js"></script>
</head>
<body>
<div class="pd-20">
	<div class="panel panel-primary">
		<div class="panel-header">基本信息</div> 
		<table class="table table-border table-bordered table-striped">
            <tr>
               	<td style="background-color: #f9f9f9;text-align: right">招聘职务：</td>
                <td style="background-color: white">
					<input type="hidden" name="id" id="id" value="{$info['id']}" />
					<input type="text" name="title" id="title" class="input-text radius" value="{$info['title']}" />
				</td>
				<td style="background-color: #f9f9f9;text-align: right">薪水区间：</td>
                <td style="background-color: white;">
					<input type="text" name="salary" id="salary" class="input-text radius" value="{$info['salary']}" />
                </td>
				<td style="background-color: #f9f9f9;text-align: right">薪水区间：</td>
                <td style="background-color: white;">
					<span class="select-box radius" style="width: 130px;">
						<select class="select" size="1" name="visible" id="visible">
							<option value="1" {1 == $info['visible'] ? 'selected' : ''}>招聘中</option>
							<option value="0" {0 == $info['visible'] ? 'selected' : ''}>已暂停</option>
						</select>
					</span>
                </td>
            </tr>
			<tr>
               	<td style="background-color: #f9f9f9;text-align: right">联系人：</td>
                <td style="background-color: white">
					<input type="text" name="nickname" id="nickname" class="input-text radius" value="{$info['nickname']}" />
				</td>
				<td style="background-color: #f9f9f9;text-align: right">联系方式：</td>
                <td style="background-color: white;">
					<input type="text" name="phone" id="phone" class="input-text radius" value="{$info['phone']}" />
                </td>
				<td style="background-color: #f9f9f9;text-align: right"></td>
                <td style="background-color: white;"></td>
            </tr>
			<tr>
				<td style="background-color: #f9f9f9;text-align: right">标签：</td>
				<td colspan="5">
					<textarea id="tags" name="tags" cols="" rows="" class="textarea radius" placeholder="说点什么...">{$info['tags']}</textarea>
				</td>
			</tr>
			<tr>
				<td width="150" class="text-r">详情描述：</td>
				<td colspan="5">
					<textarea id="elm1" name="elm1" class="xheditor" rows="14" cols="120" style="width: 100%">
						<?php echo html_entity_decode($info['content']); ?>
					</textarea>
				</td>
			</tr>
		</table>
	</div>
	<div class="mt-5 mb-5 text-c">
		<button type="button" class="btn btn-success radius submitBtn" id="admin-role-save" name="admin-role-save">
			<i class="icon-ok"></i> 确  定
		</button>
	</div>
</div>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"> </script>
<script>
	$(document).ready(function(){
		/**
		 * 提交数据
		 **/
		$(".submitBtn").on('click', function(){
			var data = {};
			if($("#title").val() == ""){
				layer.msg("请输入招聘职位", {icon: 2, time:2000});
				return false;
			}else{
				data.title = $("#title").val();
			}
			
			var salary = $("#salary").val() || "";
			if(salary.length <= 0){
				layer.msg("请输入薪水区间", {icon: 2, time:2000});
				return false;
			}else{
				data.salary = salary;
			}
			
			var tags = $("#tags").val() || "";
			if(tags.length <= 0){
				layer.msg("请输入标签", {icon: 2, time:2000});
				return false;
			}else{
				data.tags = tags;
			}
			
			var content = $("#elm1").val() || "";
			if(content.length <= 0){
				layer.msg("请输入职位描述", {icon: 2, time:2000});
				return false;
			}else{
				data.content = content;
			}
			data.id = $("#id").val();
			data.visible = $("#visible").val();
			data.nickname = $("#nickname").val();
			data.phone = $("#phone").val();
			var load = layer.load(2);
			$.post('add.html', data, function(row){
				layer.close(load);
				if(row/1 == 1){
					layer.msg('编辑成功', {icon: 1, time: 2000}, function(){
						window.parent.location.reload(); //刷新
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    	parent.layer.close(index);
					});
				}else{
					layer.msg('编辑失败', {icon: 2, time: 2000});
				}
			});
		});
	});
</script>
</body>
</html>